package com.kangyi.admin.mapper;

import com.github.pagehelper.Page;
import com.kangyi.admin.annotation.AutoFill;
import com.kangyi.dto.AddFeeDTO;
import com.kangyi.dto.FeeQueryDTO;
import com.kangyi.entity.Fee;
import com.kangyi.enumeration.OperationType;
import com.kangyi.vo.FeeVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Blank
 * @version 1.0
 */
@Mapper
public interface FeeMapper {

    Page<FeeVO> pageQuery(FeeQueryDTO feeQueryDTO);

    @Insert("insert into fee(nursing_home_id, name, price, cycle, type, notes, create_time, update_time, create_user, update_user) " +
            "VALUES (#{nursingHomeId},#{name},#{price},#{cycle},#{type},#{notes},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    @AutoFill(value = OperationType.INSERT)
    void addFee(Fee fee);

    void deleteFee(List<Integer> ids);

    @Select("select * from fee where id = #{id};")
    FeeVO getFee(Integer id);

    @AutoFill(value = OperationType.UPDATE)
    void updateFee(Fee fee);

    @Delete("delete from fee where nursing_home_id = #{nursingHomeId};")
    void deleteByNursingHomeId(Integer nursingHomeId);
}
